<template>
  <Editor
    :value="value"
    :plugins="plugins"
    :mode="mode"
    @change="handleChange"
  />
</template>

<script setup lang="ts">
import gfm from "@bytemd/plugin-gfm";
import { Editor, Viewer } from "@bytemd/vue-next";
import { ref, withDefaults, defineProps } from "vue";
import highlight from "@bytemd/plugin-highlight";

interface Props {
  value: string;
  mode?: string;
  handleChange: (v: string) => void;
}

const plugins = [
  gfm(),
  highlight(),
  // Add more plugins here
];

//props参数标准写法
const props = withDefaults(defineProps<Props>(), {
  mode: () => "split",
  value: () => "",
  handleChange: (val: string) => {
    console.log(val);
  },
});
</script>
